import { IconifyIcon } from '@/components/icons'
import { defineComponent, h, renderSlot } from 'vue'
import { RouterLink } from 'vue-router'

export default defineComponent({
  name: 'BreadItem',
  props: {
    to: {
      type: String,
      default: ''
    }
  },
  render() {
    return h('div', { class: 'xtx-bread-item' }, [
      this.to
        ? [
            h(RouterLink, { to: this.to }, () =>
              renderSlot(this.$slots, 'default')
            ),
            h(
              'i',
              { class: 'xtx-bread-item__icon' },
              h(IconifyIcon, { icon: 'uiw:right' })
            )
          ]
        : h('span', null, renderSlot(this.$slots, 'default'))
    ])
  }
})
